# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import json
import random
import re
import sys
from httplib import BadStatusLine

from lxml import etree
from pyquery import PyQuery
reload(sys)
sys.setdefaultencoding("utf-8")
import requests
import time

# 测试的urlfdfd
urls = [
    'mantoub.com',
    'chinastudents.cn',
    'www.lzxjx.com',
    'www.gongchang.com',
    'www.qq.com',
    'www.baidu.com',
    'www.zhongnongwang.com',
    'www.agronet.com.cn',
    'www.nyzy.com',
    'www.zhiziyun.com'     
    'www.npie.net',          # 存在警告漏洞
    "www.51ebo.com",         # 等级高危
    'www.ad163.com' ,        #  轻微漏洞
    'www.chuangyimao.com',   #  未知
    'xc.cdhfyym2.cn'
    'hidemyna.me',           # 国外的url
    'www.amazon.com',
    'www.bestbuy.com',
    'www.fzw114.com',
    'www.kanguowai.com',
    'www.nongli.com',
    'www.agridata.cn',  # 警告漏洞
    'www.qunar.com',
        ]
def webscan(**kwargs):
    retries = 3 if kwargs.get("retries") == None else kwargs.get("retries")
    try:
       kwargs.pop("retries")
    except:
        pass
    try:
        ipList = [
            {'http': 'socks4://59.91.122.1:46726', 'https': 'socks4://59.91.122.1:46726'},
            {'http': 'socks4://119.252.170.90:4145', 'https': 'socks4://119.252.170.90:4145'},
            {'http': 'socks4://188.186.180.101:34114', 'https': 'socks4://188.186.180.101:34114'},
            {'http': 'socks4://180.94.80.11:9999', 'https': 'socks4://180.94.80.11:9999'},
            {'http': 'socks4://196.45.151.99:56257', 'https': 'socks4://196.45.151.99:56257'},
            {'http': 'socks4://190.211.115.234:30551', 'https': 'socks4://190.211.115.234:30551'},
            {'http': 'socks4://45.4.255.128:4145', 'https': 'socks4://45.4.255.128:4145'},
            {'http': 'socks4://45.64.156.60:9999', 'https': 'socks4://45.64.156.60:9999'},
            {'http': 'socks4://185.85.162.35:1181', 'https': 'socks4://185.85.162.35:1181'},
            {'http': 'socks4://37.17.169.105:40602', 'https': 'socks4://37.17.169.105:40602'},
            {'http': 'socks4://176.196.238.234:54703', 'https': 'socks4://176.196.238.234:54703'},
            {'http': 'socks4://113.53.29.228:13629', 'https': 'socks4://113.53.29.228:13629'},
            {'http': 'socks4://118.175.93.69:46149', 'https': 'socks4://118.175.93.69:46149'},
            {'http': 'socks4://45.4.254.230:4145', 'https': 'socks4://45.4.254.230:4145'},
            {'http': 'socks4://110.74.196.66:43775', 'https': 'socks4://110.74.196.66:43775'},
            {'http': 'socks4://170.0.124.195:4145', 'https': 'socks4://170.0.124.195:4145'},
            {'http': 'socks4://95.170.115.154:40050', 'https': 'socks4://95.170.115.154:40050'},
            {'http': 'socks4://195.24.154.3:57090', 'https': 'socks4://195.24.154.3:57090'},
            {'http': 'socks4://181.112.154.170:31537', 'https': 'socks4://181.112.154.170:31537'},
            {'http': 'socks4://185.111.208.182:49472', 'https': 'socks4://185.111.208.182:49472'},
            {'http': 'socks4://45.4.85.72:54646', 'https': 'socks4://45.4.85.72:54646'},
            {'http': 'socks4://27.116.60.250:59717', 'https': 'socks4://27.116.60.250:59717'},
            {'http': 'socks4://125.165.178.27:53226', 'https': 'socks4://125.165.178.27:53226', },
            {'http': 'socks4://168.228.112.165:4145', 'https': 'socks4://168.228.112.165:4145'},
            {'http': 'socks4://212.5.107.81:41488', 'https': 'socks4://212.5.107.81:41488'},
            {'http': 'socks4://81.33.4.214:49311', 'https': 'socks4://81.33.4.214:49311'},
            {'http': 'socks4://202.129.185.161:14153', 'https': 'socks4://202.129.185.161:14153'},
            {'http': 'socks4://45.230.242.200:60589', 'https': 'socks4://45.230.242.200:60589'},
            {'http': 'socks4://103.76.142.5:39851', 'https': 'socks4://103.76.142.5:39851'},
            {'http': 'socks4://85.187.195.166:31315', 'https': 'socks4://85.187.195.166:31315'},
            {'http': 'socks4://178.16.136.7:4145', 'https': 'socks4://178.16.136.7:4145'},
            {'http': 'socks4://103.69.217.209:50950', 'https': 'socks4://103.69.217.209:50950'},
            {'http': 'socks4://102.176.160.17:41836', 'https': 'socks4://102.176.160.17:41836'},
            {'http': 'socks4://45.71.230.3:41846', 'https': 'socks4://45.71.230.3:41846'},
            {'http': 'socks4://112.170.31.133:4145', 'https': 'socks4://112.170.31.133:4145'},
            {'http': 'socks4://119.42.70.13:37753', 'https': 'socks4://119.42.70.13:37753'},
            {'http': 'socks4://176.107.80.53:42303', 'https': 'socks4://176.107.80.53:42303'},
            {'http': 'socks4://95.154.73.153:41538', 'https': 'socks4://95.154.73.153:41538'},
            {'http': 'socks4://103.245.188.86:46838', 'https': 'socks4://103.245.188.86:46838'},
            {'http': 'socks4://82.137.255.178:4145', 'https': 'socks4://82.137.255.178:4145'},
            {'http': 'socks4://138.36.158.150:4145', 'https': 'socks4://138.36.158.150:4145'},
            {'http': 'socks4://89.108.154.122:4145', 'https': 'socks4://89.108.154.122:4145'},
            {'http': 'socks4://138.219.111.200:4145', 'https': 'socks4://138.219.111.200:4145'},
            {'http': 'socks4://168.121.137.58:4145', 'https': 'socks4://168.121.137.58:4145'},
            {'http': 'socks4://114.129.17.44:4145', 'https': 'socks4://114.129.17.44:4145'},
            {'http': 'socks4://202.93.225.41:4145', 'https': 'socks4://202.93.225.41:4145'},
            {'http': 'socks4://112.78.169.98:53106', 'https': 'socks4://112.78.169.98:53106'},
            {'http': 'socks4://88.84.222.208:4145', 'https': 'socks4://88.84.222.208:4145'},
            {'http': 'socks4://14.241.38.125:38790', 'https': 'socks4://14.241.38.125:38790'},
            {'http': 'socks4://204.0.52.231:63719', 'https': 'socks4://204.0.52.231:63719'},
            {'http': 'socks4://188.235.11.88:32216', 'https': 'socks4://188.235.11.88:32216'},
            {'http': 'socks4://95.154.81.65:31810', 'https': 'socks4://95.154.81.65:31810'},
            {'http': 'socks4://122.102.39.65:44550', 'https': 'socks4://122.102.39.65:44550'},
            {'http': 'socks4://118.174.233.27:42165', 'https': 'socks4://118.174.233.27:42165'},
            {'http': 'socks4://89.47.115.9:4145', 'https': 'socks4://89.47.115.9:4145'},
            {'http': 'socks4://200.223.17.130:9999', 'https': 'socks4://200.223.17.130:9999'},
            {'http': 'socks4://103.248.219.139:46018', 'https': 'socks4://103.248.219.139:46018'},
            {'http': 'socks4://125.25.80.42:51005', 'https': 'socks4://125.25.80.42:51005'},
            {'http': 'socks4://78.156.243.146:56823', 'https': 'socks4://78.156.243.146:56823'},
            {'http': 'socks4://178.93.45.1:47940', 'https': 'socks4://178.93.45.1:47940'},
            {'http': 'socks4://103.233.207.226:4145', 'https': 'socks4://103.233.207.226:4145'},
            {'http': 'socks4://80.122.202.102:42523', 'https': 'socks4://80.122.202.102:42523'},
            {'http': 'socks4://185.8.68.8:60609', 'https': 'socks4://185.8.68.8:60609'},
            {'http': 'socks4://1.20.97.190:60418', 'https': 'socks4://1.20.97.190:60418'},
            {'http': 'socks4://185.19.214.90:4145', 'https': 'socks4://185.19.214.90:4145'},
            {'http': 'socks4://91.222.154.39:46702', 'https': 'socks4://91.222.154.39:46702'},
            {'http': 'socks4://89.28.12.62:45710', 'https': 'socks4://89.28.12.62:45710'},
            {'http': 'socks4://167.250.178.186:4145', 'https': 'socks4://167.250.178.186:4145'},
            {'http': 'socks4://221.120.160.228:44880', 'https': 'socks4://221.120.160.228:44880'},
            {'http': 'socks4://87.229.1.137:4145', 'https': 'socks4://87.229.1.137:4145'},
            {'http': 'socks4://45.4.254.129:4145', 'https': 'socks4://45.4.254.129:4145'},
            {'http': 'socks4://159.65.184.162:9050', 'https': 'socks4://159.65.184.162:9050'},
            {'http': 'socks4://77.94.121.51:49503', 'https': 'socks4://77.94.121.51:49503'},
            {'http': 'socks4://37.220.69.83:46496', 'https': 'socks4://37.220.69.83:46496'},
            {'http': 'socks4://176.106.46.28:4145', 'https': 'socks4://176.106.46.28:4145'},
            {'http': 'socks4://107.135.254.236:48282', 'https': 'socks4://107.135.254.236:48282'},
            {'http': 'socks4://14.192.27.206:38006', 'https': 'socks4://14.192.27.206:38006'},
            {'http': 'socks4://85.15.189.121:49343', 'https': 'socks4://85.15.189.121:49343'},
            {'http': 'socks4://180.211.162.114:56003', 'https': 'socks4://180.211.162.114:56003'},
            {'http': 'socks4://131.196.141.204:50489', 'https': 'socks4://131.196.141.204:50489'},
            {'http': 'socks4://103.216.82.213:6667', 'https': 'socks4://103.216.82.213:6667'},
            {'http': 'socks4://107.181.174.75:55667', 'https': 'socks4://107.181.174.75:55667'},
            {'http': 'socks4://170.246.36.14:4145', 'https': 'socks4://170.246.36.14:4145'},
            {'http': 'socks4://202.131.234.142:55157', 'https': 'socks4://202.131.234.142:55157'},
            {'http': 'socks4://200.1.181.116:32690', 'https': 'socks4://200.1.181.116:32690'},
            {'http': 'socks4://125.26.6.30:38052', 'https': 'socks4://125.26.6.30:38052'},
            {'http': 'socks4://188.170.38.66:61610', 'https': 'socks4://188.170.38.66:61610'},
            {'http': 'socks4://185.252.112.151:4145', 'https': 'socks4://185.252.112.151:4145'},
            {'http': 'socks4://81.16.10.254:3629', 'https': 'socks4://81.16.10.254:3629'},
            {'http': 'socks4://109.167.126.232:39973', 'https': 'socks4://109.167.126.232:39973'},
            {'http': 'socks4://185.21.223.220:57017', 'https': 'socks4://185.21.223.220:57017'},
            {'http': 'socks4://87.229.47.237:4145', 'https': 'socks4://87.229.47.237:4145'},
            {'http': 'socks4://171.100.0.170:4145', 'https': 'socks4://171.100.0.170:4145'},
            {'http': 'socks4://110.78.146.228:4145', 'https': 'socks4://110.78.146.228:4145'},
            {'http': 'socks4://103.250.153.198:51460', 'https': 'socks4://103.250.153.198:51460'},
            {'http': 'socks4://109.202.17.4:61210', 'https': 'socks4://109.202.17.4:61210'},
            {'http': 'socks4://131.196.143.99:50489', 'https': 'socks4://131.196.143.99:50489'},
            {'http': 'socks4://82.137.255.48:4145', 'https': 'socks4://82.137.255.48:4145'},
            {'http': 'socks4://159.224.13.29:41584', 'https': 'socks4://159.224.13.29:41584'},
            {'http': 'socks4://103.35.170.102:1080', 'https': 'socks4://103.35.170.102:1080'},
            {'http': 'socks4://170.0.124.138:4145', 'https': 'socks4://170.0.124.138:4145'},
            {'http': 'socks4://200.93.224.178:50833', 'https': 'socks4://200.93.224.178:50833'},
                  ]
        # url = random.choice(urls)
        url = "www.qq.com"
        proxies = random.choice(ipList)

        # proxies = {"http":"http://172.20.10.22:3131","https":"http://172.20.10.22:3131"}
        response = requests.get('http://webscan.360.cn/index/checkwebsite', {
            'url': str(url),
        },proxies=proxies)
        html = response.content
        if response.status_code != 200:
            print '网页获取失败',response.status_code
        else:
            # print response.status_code
            time = re.findall(r'&token=(.+?),', str(html))
            time = str(time[0]).split('=')[-1]
            time = time[:-1]
            token = re.findall(r'data(.+?)&time', str(html))
            token = str(token[0]).split('=')[-1]
            rep = requests.post("http://webscan.360.cn/index/gettrojan", {
                'url': str(url),
                'token': token,
                'time': time,
            })
            content = rep.text
            print content
            state = re.search(r'"kx":{"state":"?(\d+?)"?', str(content))
            state = state.groups()[0]
            false_text = ''
            house_text = ''
            false_status = ''
            house_status = ''
            type = ''
            if state == '1':
                false_text = '正常'
                house_text = '正常'
                false_status = '正常'
                house_status = '正常'
            else:
                if not type and state == '0':
                    false_text = '正常'
                    house_text = '正常'
                    false_status = '正常'
                    house_status = '正常'
                if state == '0':
                    content = str(content)
                    content = json.loads(content)
                    type = content['trojan']['type']
                    st = content['trojan']['st']
                    sc = content['trojan']['sc']
                    if type == '60':
                        if st == '10':
                            if sc == '100':
                                false_text = "该网站推广的产品或其治疗范围属于国家明令禁止进行医疗广告的范畴，或使用了违禁内容或方式，请谨慎访问。"
                            elif sc == '101':
                                false_text = "该网站含有未经证实的金融证券相关内容，如果网站存在模拟登录、未经批准收取会员费等行为，会给您造成财产损失。"
                            elif sc == '102':
                                false_text = "该网站含有未经证实的彩票相关内容，如果网站未获经营许可而向您收取会员费、预测费、保密费等费用，会给您造成财产损失。"
                            elif sc == "103":
                                false_text = "该网站含有未经证实的境外博彩相关内容或广告链接，不可靠的博彩相关内容可能给您造成财产损失，请您谨慎访问。"
                            elif sc == '104':
                                false_text = "该网站含有未经证实的中奖活动内容，虚假的中奖活动网站会要求您支付中奖相关费用或输入账号密码，请您谨慎访问。"
                            elif sc == '105':
                                false_text = "该网站存在未经证实的用户登录框内容，通过未经证实的登录框登录，可能会导致账号信息被盗，请您谨慎访问。"
                            elif sc == '106':
                                false_text = "该网站存在未经证实的商品、商户、支付等相关信息，虚假交易信息可能会给您造成财产损失，请确认是否为官方网站。"
                            elif sc == '107':
                                false_text = "该网站含有未经证实的软件下载信息，下载带有木马的软件可能对您的电脑安全造成威胁，请您谨慎访问。"
                            elif sc == '108':
                                false_text = "该网站含有大量未经证实的广告信息，虚假广告可能给您造成财产损失，请您谨慎访问。"
                            elif sc == '109':
                                false_text = "该网站含有未经证实的弹窗广告信息，误点击模仿常用软件弹窗的内容可能会给您的电脑安全造成威胁，请您谨慎访问。"
                            elif sc == '110':
                                false_text = "该网站含有大量未经证实的信息，访问含有欺诈内容的网站可能会给您造成财产损失，请您谨慎访问。"
                            elif sc == '111':
                                false_text = "该网站可能盗用其他正规网站的标识，可能会给您带来损失，请谨慎访问。"
                            elif sc == '112':
                                false_text = "该网站含有大量未经证实的招聘信息，虚假招聘网站可能会让应聘者支付保证金、保密费、手续费等各种费用，请您谨慎访问。"
                            elif sc == '113':
                                false_text = "该网站所属学校不在教育部公布的全国普通高校、院校信息库中。未经教育部批准的学校属于虚假办学，请您谨慎访问。"
                            elif sc == '114':
                                false_text = "该网站不具备中国航空运输协会颁发的机票销售代理资质，假冒的机票销售网站诱骗访问者上当，骗取您的个人信息和钱财。"
                            elif sc == '115':
                                false_text = "该网站多个子域名或页面存在虚假或恶意内容，虚假和恶意的内容会诱骗访问者上当或使您的计算机感染木马或病毒，此种情况可能是因为网站被黑客入侵篡改，为了避免给您造成损失，360安全中心已经帮您拦截，请您谨慎访问。"
                            elif sc == '116':
                                false_text = "当前页面含有大量虚假信息，误信虚假电话和账号信息可能会给您造成财产损失，请您谨慎访问。"
                            elif sc == '117':
                                false_text = "当前页面是一个假冒的话费充值网站，在假冒的话费充值网站充值将会给您造成财产损失，请谨慎访问。"
                            elif sc == '118':
                                false_text = "当前页面是一个假冒的团购网站，在假冒的团购网站购物将会给您造成财产损失，请谨慎访问。"
                            elif sc == '119':
                                false_text = "当前页面是一个假冒的网游交易网站，在假冒的网游交易网站购买商品将会给您造成财产损失，请谨慎访问。"
                            elif sc == '120':
                                false_text = "此网站可能通过混淆其他正规网站的标识来误导用户，为了避免可能会给您带来的损失，请谨慎访问。"
                        else:
                            false_text ='正常'
                        if st == '20':
                            if sc == '100' or sc == '101':
                                house_text = "经360安全中心鉴定从此网站下载的文件包含木马病毒，为了让您的系统安全，建议您立即停止下载！"
                            elif sc == "103":
                                house_text = "该网站伪装成小说、色情或外挂网站传播木马，木马病毒侵入您的系统，可能会导致账号密码、私人数据等个人信息被窃取。"
                            elif sc == '102':
                                house_text = "最近360安全中心收到大量用户投诉，从该网站下载文件时被欺骗安装了木马等危险程序，造成主页被篡改、账户被盗等。"
                            elif sc == '104':
                                house_text = '有挂马或恶意内容'
                        else:
                            house_text = '正常'
                    else:
                        if type == '70':
                            false_text = "该网站当前页面带有木马或病毒，木马或病毒会给您的电脑安全造成威胁，建议立即关闭此页面。"
                    if type == '60' and st == '10':
                        false_status = '有虚假或欺诈'
                    else:
                        false_status = '正常'
                    if type == '60' and st == '20':
                        house_status = '有挂马或恶意'
                    else:
                        house_status = '正常'
                    if type == '0' and st == '30':
                        false_status = '正常'
                        house_status = '正常'
                        false_text = '正常'
                        house_text = '正常'
            dom = etree.HTML(html)
            webld_status = dom.xpath('//dl[@class="clearfix"]/dd/p/text()')[0]  # 网站漏洞
            webld_status = str(webld_status)
            malicious_status = dom.xpath('//dl[4][@class="clearfix"]/dd/p/text()')[0] #  篡改
            malicious_status = str(malicious_status)
            sensitive_status = dom.xpath('//dl[5][@class="clearfix"]/dd/p/text()')[0]  # 敏感
            sensitive_status = str(sensitive_status)
            web_monitor = dom.xpath('string(//div[@class="ld-main-list"])')
            web_monitor = web_monitor.replace('漏洞信息已隐藏，只对网站管理员开放  请先验证权限', '').replace('%', '%,').replace('存在"', '存在') \
                .replace('\r', '').replace('\t', '').replace(' ', '').replace('\n', '').replace('"风险', '风险')
            web_monitor = web_monitor[:-1]
            web_monitor = str(web_monitor).strip(',').split(',')
            if web_monitor == [""]:
                web_monitor = '正常'
            try:
                malicious_text = dom.xpath('//*[@id="report_cg"]/div/text()')[0]    # 黑客篡改网站监控 详情
                malicious_text = str(malicious_text).replace('\r', '').replace('\n', '').replace('\t', '').replace(u'　　', '')
            except:
                malicious_monitor_details= dom.xpath('string(//*[@id="report_cg"]/table)')
                malicious_text = str(malicious_monitor_details).replace('com','com,').replace('COM','COM,').replace('黑客植入恶意链接:',',黑客植入恶意链接:').replace('恶意关键词:',',恶意关键词:').replace('恶意内容','恶意内容,').replace('收起','')\
                    .replace('修复方案','').replace('篡改解封','').replace('申请解封权限只对网站管理员开放，请先验证权限','').replace('\r', '').replace('\n', '').replace('\t', '').replace(u' ', '').replace(u"","")
                malicious_text = str(malicious_text).replace('com,,', 'com,')
                malicious_text = str(malicious_text).strip(',').split(',')
            try:
                sensitive_text = dom.xpath('//*[@id="report_vg"]/div/text()')[0]     # 网站敏感内容监控 详情
                sensitive_text = str(sensitive_text).replace(u'　　', '')
            except:
                sensitive_monitor_detail = dom.xpath('string(//*[@id="report_vg"]/table)')
                sensitive_text = str(sensitive_monitor_detail).replace('\r', '').replace('\n', '').replace('\t', '').replace(u' ', '')
                sensitive_text = str(sensitive_text).replace(u'　　', '').strip(',').split(',')
            #  网站漏洞 页面
            web_time = dom.xpath('//div[@class="login-user-check login-user-check2"]/h4/strong/text()')[0]
            web_time = str(web_time).replace(u'漏洞时间：','')
            web_time = str(web_time)
            high_page = dom.xpath('//ul/li[1]/span/text()')[0]
            mid_page = dom.xpath('//ul/li[2]/span/text()')[0]
            low_page = dom.xpath('//ul/li[3]/span/text()')[0]
            info_page = dom.xpath('//ul/li[4]/span/text()')[0]
            # 分数
            if malicious_status ==  "遭恶意篡改":
                iscuangai = '1'
            else:
                iscuangai = '0'
            if false_status == '有虚假或欺诈':
                isxujia = '1'
            else:
                isxujia = '0'
            if sensitive_status == '存在敏感内容':
                isviolation = '1'
            else:
                isviolation = '0'
            if house_status == '有挂马或恶意':
                isguama = '1'
            else:
                isguama = '0'
            rep = requests.post("http://webscan.360.cn/webscore/index", {
            'domain': str(url),
            'isxujia': isxujia,
            'iscuangai': iscuangai,
            'isviolation':isviolation,
            'isguama':isguama,
            'pangzhu': 0,
            'high': high_page,
            'mid': mid_page,
            'low': low_page,
            'info': info_page})
            score = rep.content
            score = str(score).replace("<span class='ratevul'>","").replace('</span>','')
            rate = re.findall(r'"rate":(.+?)}',str(score))
            rate =  rate[0]
            if webld_status == '存在高危漏洞' or false_status == '有虚假或欺诈' or house_status == '有挂马或恶意' or malicious_status ==  "遭恶意篡改" or sensitive_status == '存在敏感内容':
                level = '高危'
            elif webld_status == '存在警告漏洞':
                level = '警告'
            elif webld_status == '存在严重漏洞':
                level = '严重'
            else:
                level = '安全'

            data = {'data':{'score': score,
                        'safe_level':{
                             'domain':url,                              # 域名
                             'level':level                              # 等级
                        },
                         'loudong': {                                   # page
                             'web_time':web_time,
                             'high': high_page,
                             'mid': mid_page,
                             'low': low_page,
                             'info': info_page
                         },
                         'web_loudong': {
                             'webld': webld_status,                      # 网站漏洞
                             'isxujia': false_status,                    # 虚假欺诈
                             'isguama': house_status,                    # 挂马
                             'iscuangai': malicious_status,              # 遭恶意篡改
                             'isviolation': sensitive_status             # 存在敏感
                         },
                         'websf_loudong': {
                             'webld_monitor': web_monitor,               # 网站安全漏洞
                             'xujia_moitor': false_text,                 # 虚假监控
                             'guama_monitor': house_text,                # 挂马监控
                             'cuangai_monitor': malicious_text,          # 黑客篡改网站监控
                             'isviolation_monitor': sensitive_text,      # 网站敏感内容监控

                         }}}
            print '^^^^^^^^^^^^^^^^^^^^'
            data = json.dumps(data,encoding="UTF-8", ensure_ascii=False)
            data = data.replace("\\","").replace('"{','{').replace('}"','}')
            print data
    except Exception as e:
        print e
        if e == ('Connection aborted.', BadStatusLine("''",)) and retries == 3:
            return '网站未认证'
        if retries > 0:
            retries -= 1
            kwargs["retries"] = retries




if __name__ == '__main__':
    webscan()

    # while True:
    #     start = int(time.time())
    #     webscan()
    #     end = int(time.time())
    #     print ('times is ', end - start)
    #     time.sleep(6)




